package com.quickthumb.game;

import java.util.ArrayList;

import javax.microedition.khronos.opengles.GL10;

import android.graphics.Canvas;
import android.graphics.Paint;

public class Player implements UpdateAndDraw {

	public static int time, score;

	public static Powerups powerups;

	public static float drawer_y;
	public static boolean drawer_open;
	public static final float DRAWER_HEIGHT = 0.5f;
	public MenuTool menuTool=new MenuTool();
	
	public static ArrayList<Rat> huntedRats=new ArrayList<Rat>();

	@Override
	public void init() {
		
		score = 0;
		drawer_y = 0;
		drawer_open = false;
		time = 30 * 30;
		powerups = new Powerups();
		powerups.init();
		menuTool.init();
		for(int i=0;i<5;i++)
		{
			Block t=new BlockTrap(new TrapFish());
			if(i>2)
				t=new BlockTrap(new TrapCheese());
			t.init();
			t.setPosition(i);
			MenuTool.list[i]=t;
		}
		
		
	}

	@Override
	public void update() {
		powerups.update();
		time--;
		if (time <= 0)
			java.lang.System.exit(0);
		if (drawer_open)
			drawer_y += (1 - drawer_y) * 0.1f;
		else
			drawer_y += (0 - drawer_y) * 0.1f;
	}

	@Override
	public void draw(Canvas c, Paint p) {
		menuTool.draw(c, p);
		powerups.draw(c, p);
	}

	@Override
	public void draw(GL10 gl) {
		powerups.draw(gl);
		// TODO Auto-generated method stub

	}

	@Override
	public void destroy() {
		powerups.destroy();
		// TODO Auto-generated method stub

	}

	public static void changeScore(int s) {
		score += s * Powerups.score_multiply * Powerups.score_enable;
	}

}
